package com.meixiang.view;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.meixiang.R;
import com.meixiang.activity.account.myShopper.OrderSaleActivity;


/**
 * Created by yinsujun on 2016/4/5 0005  14.
 */
public class OrderLinearLayout extends LinearLayout {

    private boolean isSale;
    public OrderLinearLayout(Context context,boolean isShow) {
        super(context);
        initView(context,isShow);
    }
    public OrderLinearLayout(Context context,boolean isShow,boolean isSale) {
        super(context);
        this.isSale=isSale;
        initView(context,isShow);
    }


    private void initView(final Context context, boolean isShow){
        View view= LayoutInflater.from(context).inflate(R.layout.activity_all_order_custom_list_items,null);
        View line=view.findViewById(R.id.all_order_item_view_line);
        TextView tvSale= (TextView) view.findViewById(R.id.all_order_item_tv_after_sale);
        if(isSale==true){
            tvSale.setVisibility(VISIBLE);
        }else{
            tvSale.setVisibility(GONE);
        }
        if(isShow==true){
            line.setVisibility(View.VISIBLE);
        }else{
            line.setVisibility(View.GONE);
        }
        tvSale.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context,OrderSaleActivity.class));
            }
        });
        this.addView(view);
    }
}
